<!-- 预览文章对话框 -->
<template>
  <div class="container">
    <el-dialog title="预览文章" :visible.sync="dialogVisible" width="50%">
      <h2>{{ data.title }}</h2>
      <div class="middle">
        <span>{{data.createTime|parseTimeByString }}</span>
        <span>{{ data.username }}</span>
        <span class="el-icon-view"></span>
        <span>{{ data.visits }}</span>
      </div>
      <div v-html="data.articleBody" class="bottom"></div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      default: () => { },
      type: Object
    }
  },
  data () {
    return {
      dialogVisible: false
    }
  },
  methods: {
    showArticle () {
      this.dialogVisible = true
    }
  }
}
</script>

<style scoped lang='scss'>
h2 {
  margin: 0;
  padding: 0;
}
.middle {
  border-bottom: 1px dashed white;
  padding-bottom: 10px;
  span {
    margin-left: 10px;
    margin-top: 10px;
  }
}
.bottom {
  background-color: #f5f5f5;
  padding: 10px;
}
</style>
